﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UI/Site.Master" AutoEventWireup="true"
    CodeBehind="SaleProductUI.aspx.cs" Inherits="SalesAndStoreApp.UI.SalesManager.SaleProductUI" %>

<%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.1.60501.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
   </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div style="width: 668px; height: 23px;">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;
        <br />
    </div>
    <div id="main_Div">
        <div id="Title_Div" class="style1">
            <strong>
                <br />
                Sell Product To Customer: </strong>
            <br />
            <br />
        </div>
        <div id="product_store_div" class="divSubjectStyle" 
            style="padding: 30px; height: 700px; margin-bottom: 20px;">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <br />
            <div class="divSubjectStyle" id="product_stand_div" runat="server">
                <div style="width: 241px; margin-left: 380px">
                    Date:
                    <asp:TextBox ID="dateTextBox" runat="server" CssClass="datePicker" BorderStyle="None"></asp:TextBox>
                    <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="dateTextBox">
                    </ajaxToolkit:CalendarExtender>
                </div>
                <div id="product_Item_Insertion_Div" class="divStyle">
                    <asp:Label ID="Label1" runat="server" Text="Product/Item:  "></asp:Label>
                    <asp:DropDownList ID="productDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="productDropDownList_SelectedIndexChanged">
                    </asp:DropDownList>
                    &nbsp;&nbsp;&nbsp;<asp:Label ID="Label2" runat="server" Text="Qty:  "></asp:Label>
                    &nbsp;
                    <asp:TextBox ID="quantityTextBox" runat="server" Width="44px"></asp:TextBox>
                    <br />
                    <asp:Label ID="Label3" runat="server" Text="UnitPrice: "></asp:Label>
                    <asp:Label ID="unitPriceLabel" runat="server" Text=""></asp:Label>
                 
                    <br />
                </div>
                    <br />
                <div id="add_action_div" class="divStyle">
                   
                    <div>
                        <asp:Button ID="addButton" runat="server" Text="+ Add" Style="margin-left: 398px"
                            OnClick="addButton_Click" Width="91px" BackColor="#006600" ForeColor="White"
                            Height="34px" />
                    </div>
                </div>
            </div>
            <br />
            <div id="details_list_div" class="divSubjectStyle">
                The Added Products...
                <br />
                <asp:ListView ID="productStoreListView" runat="server" DataSourceID="ObjectDataSource1"
                    Style="margin-right: 0px">
                    <LayoutTemplate>
                        <table id="Table1" runat="server">
                            <tr id="Tr1" runat="server">
                                <td id="Td1" runat="server">
                                    <table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;
                                        border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;
                                        font-family: Verdana, Arial, Helvetica, sans-serif;">
                                        <tr id="Tr2" runat="server" style="background-color: #DCDCDC; color: #000000;">
                                            <th id="Th1" runat="server" hidden="true">
                                                Id
                                            </th>
                                            <th id="Th2" runat="server">
                                                Name
                                            </th>
                                            <th id="Th3" runat="server">
                                                Unit Price
                                            </th>
                                            <th id="Th4" runat="server">
                                                Quantity
                                            </th>
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr id="Tr3" runat="server">
                                <td id="Td2" runat="server" style="text-align: center; background-color: #CCCCCC;
                                    font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;">
                                    <asp:DataPager ID="DataPager1" runat="server">
                                        <Fields>
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
                                        </Fields>
                                    </asp:DataPager>
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <AlternatingItemTemplate>
                        <tr style="background-color: #FFF8DC;">
                            <td hidden="true">
                                <asp:Label ID="idLabel" runat="server" Text='<%# Eval("Id") %>' />
                            </td>
                            <td>
                                <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("Name") %>' />
                            </td>
                            <td>
                                <asp:Label ID="unitPriceLabel" runat="server" Text='<%# Eval("SaleUnitPrice") %>' />
                            </td>
                            <td>
                                <asp:Label ID="quantityLabel" runat="server" Text='<%# Eval("Inventory.Quantity") %>' />
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                    <EmptyDataTemplate>
                        <table id="Table2" runat="server" style="background-color: #FFFFFF; border-collapse: collapse;
                            border-color: #999999; border-style: none; border-width: 1px;">
                            <tr>
                                <td style="color: red">
                                    No Product is Added.
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <ItemTemplate>
                        <tr style="background-color: #DCDCDC; color: #000000;">
                            <td hidden="true">
                                <asp:Label ID="idLabel" runat="server" Text='<%# Eval("Id") %>' Visible="False" />
                            </td>
                            <td>
                                <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("Name") %>' />
                            </td>
                            <td>
                                <asp:Label ID="unitPriceLabel" runat="server" Text='<%# Eval("SaleUnitPrice") %>' />
                            </td>
                            <td>
                                <asp:Label ID="quantityLabel" runat="server" Text='<%# Eval("Inventory.Quantity") %>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <SelectedItemTemplate>
                        <tr style="background-color: #008A8C; font-weight: bold; color: #FFFFFF;">
                            <td hidden="true">
                                <asp:Label ID="idLabel" runat="server" Text='<%# Eval("Id") %>' Visible="False" />
                            </td>
                            <td>
                                <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("Name") %>' />
                            </td>
                            <td>
                                <asp:Label ID="unitPriceLabel" runat="server" Text='<%# Eval("SaleUnitPrice") %>' />
                            </td>
                            <td>
                                <asp:Label ID="quantityLabel" runat="server" Text='<%# Eval("Inventory.Quantity") %>' />
                            </td>
                        </tr>
                    </SelectedItemTemplate>
                </asp:ListView>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAll"
                    TypeName="SalesAndStoreApp.DAL.DAO.ViewProductsDAO">
                    <SelectParameters>
                        <asp:SessionParameter DefaultValue="new List&lt;Product&gt;();" Name="products" SessionField="Products"
                            Type="Object" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <br />
                <asp:Label ID="Label6" runat="server" Text="Total Price :"></asp:Label>
                <asp:Label ID="totalPriceLabel" runat="server"></asp:Label>
                <br />
                <br />
            </div>
            <div id="save_action_div">
                <asp:Button ID="saleButton" runat="server" Text="Sell" Style="margin-left: 425px"
                    BackColor="#006600" Font-Bold="True" ForeColor="White" Width="91px" OnClick="saleButton_Click"
                    Height="35px" />
                <br />
            </div>
            <div id="message_div">
                <asp:Label ID="messageLabel" runat="server" Text=""></asp:Label>
            </div>
        </div>
    </div>
</asp:Content>
